library(class)
library(e1071)
source('./config.r')
source('./src/prepare.r')

print('Preparing classifier...')
B.cl <- naiveBayes(as.factor(d.label) ~., data = d.data, laplace = 0)
print('Predicting classes...')


B.pred <- list()
accuracy <- c()
thresholds <- c(0.001, 0.005, 0.01, 0.05, 0.1, 0.2, 0.5, 0.7, 0.9)

for (t in thresholds) {
    print('Threshold')
    print(t)
    B.pred <- predict(B.cl, t.data, threshold = t)
    accuracy <- append(accuracy, sum(B.pred == t.label) / length(t.label))
}

plot(accuracy)
